/**
 * Copyright (C), 2015-2021, 开度
 * FileName: UserInfoController
 * Author:   ASUS
 * Date:     2021/4/28 14:52
 * Description: 操作用户 增删改查
 * History:
 * <author>          <time>          <version>          <desc>
 * Hezeyu           2021/4/28           1.0              操作用户 增删改查
 */
package com.example.spring.security.controller;

import com.example.spring.security.dto.UserInfoDto;
import com.example.spring.security.pojo.UserPojo;
import com.example.spring.security.service.UserInfoServie;
import com.example.spring.security.utils.BaseResponse;
import com.example.spring.security.utils.PageUtils;
import com.example.spring.security.vo.UserInfoManagerVo;
import com.example.spring.security.vo.UserInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 〈操作用户 增删改查〉
 *
 * @author ASUS
 * @create 2021/4/28
 * @since 1.0.0
 */
@RestController
@RequestMapping("users")
@Api(tags = "用户管理")
@Slf4j
public class UserInfoController {

    @Autowired
    private UserInfoServie userInfoServie;



    @PostMapping
    @ApiOperation(value = "查询用户列表", notes = "用户列表")
    public BaseResponse<PageUtils<UserPojo>> select(@RequestBody @Valid UserInfoManagerVo userInfoManagerVo){
        return userInfoServie.select(userInfoManagerVo);
    }

    @PostMapping("/login")
    @ApiOperation(value = "登录", notes = "登录操作")
    public BaseResponse<UserInfoDto> login(@RequestBody @Valid UserInfoVo userInfoVo) {
       return userInfoServie.login(userInfoVo);
    }
}
